﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace RecordBill.Common
{
    public class BoolToBackgroundConverter : IValueConverter
    {
        // True时的颜色（默认绿色）
        public Brush TrueBrush { get; set; } = Brushes.LightCyan;

        // False时的颜色（默认红色）
        public Brush FalseBrush { get; set; } = Brushes.White;

        // 当值为null时的颜色（默认灰色）
        public Brush NullBrush { get; set; } = Brushes.Gray;

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is bool boolValue)
            {
                return boolValue ? TrueBrush : FalseBrush;
            }

            return NullBrush;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
